<!DOCTYPE html>
<html lang="zh-CN">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Bootstrap 101 Template</title>
    <link href="css/bootstrap.min.css" rel="stylesheet">
    <script src="js/jquery.min.js"></script>
    <script src="js/bootstrap.min.js"></script>
    <![endif]-->
</head>
<body>
<nav class="navbar navbar-default">
    <div class="container-fluid">
        <div class="navbar-header">
            <!--生成汉堡按钮-->
            <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
                <span class="sr-only">Toggle navigation</span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
                <span class="icon-bar"></span>
            </button>
            <a class="navbar-brand" href="index.html">Takser</a>
        </div>

        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
            <ul class="nav navbar-nav">
                <li><a href="login.html">新建任务</a></li>
            </ul>
            <ul class="nav navbar-nav navbar-right">
                <li><a href="about.html">关于</a></li>
            </ul>
        </div>
    </div>
</nav>

<script type="text/javascript">

    function showlist() {
        $.ajax({
            url:"ShowTaskListServlet",
            type:"post",
            data:{
                createFor:1,
            },
            success:function (data) {
                console.log(data);
                let json = $.parseJSON(data);
                for (let i = 0;i < json.length;i++){
                    let html = "<a href=\" detail.html?tid="+ json[i].tid +" \" class=\"list-group-item\">\n" +
                        "            <h4 class=\"list-group-item-heading\">"+json[i].title+"</h4>\n" +
                        "            <p class=\"list-group-item-text\">"+json[i].content+"</p>\n" +
                        "        </a>"
                    $("#div1").append(html);
                }
            }
        })
    }
    window.onload = function () {
        showlist();
    }

</script>
<div class="container">
    <div class="list-group" id = "div1">

    </div>
</div>
</body>
</html>